#ifndef LEASESMODEL_H
#define LEASESMODEL_H

#include <QAbstractTableModel>
#include "dbmscontainer.h"



class LeasesModel : public QAbstractTableModel, public DbmsContainer
{
    Q_OBJECT
    QVariantList mqvl_indexes;
    int m_last_row;
    SLEE_HDB_REC mqh_data;
public:
    struct Filter
    {
        QString mqstr_street;
        QString mqstr_house;
        QString mqstr_ap_num;
        QString mqstr_ten_fam;
        QDate   mqd_s;
        QDate mqd_e;
        bool m_before_s;
        bool m_before_e;
        Filter():
            m_before_s(false),
            m_before_e(false)  {}
    };

    explicit LeasesModel(QObject *parent = 0);
    void load_data(const LeasesModel::Filter *p_filter = NULL);
    int rowCount(const QModelIndex &parent) const;
    int columnCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role) const;
    QVariant get_db_index(const QModelIndex &mod_index);
    QModelIndex get_mod_index(const QVariant & qv_l_index);
    void update_data(const QModelIndex & mod_index);
signals:

public slots:

};

#endif // LEASESMODEL_H
